﻿using AnesSystem.Models.Model.Hospital.SC.WJZYY;
using AnesSystem.ViewModels.Operation.SC.WJZYY;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace AnesSystem.Controls.Operation.SC.WJZYY
{
    /// <summary>
    /// HisAnesMethodCtrl.xaml 的交互逻辑
    /// </summary>
    public partial class HisAnesMethodWin : Window
    {
        private HisAnesMethodCtrlViewModel _model;
        public HisAnesMethodWin()
        {
            InitializeComponent();
            _model = new HisAnesMethodCtrlViewModel();
            this.DataContext = _model;
            this.Loaded += HisAnesMethodCtrl_Loaded;
        }

        public SelHisAnesMethodModel SelectAnesMethod
        {
            get
            {
                return _model.SelectAnesMethod;
            }

            set
            {
                _model.SelectAnesMethod = value;
            }
        }

        private void HisAnesMethodCtrl_Loaded(object sender, RoutedEventArgs e)
        {
   //         _model.RefWin();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Button button = sender as Button;
            string tag = button.Tag.ToString();
            switch (tag)
            {
                case "ok":
                    //                   HisAnesMethodCtrlViewModel.Instance.ChangeAnesMethod();
                    //                  DrugAndEventWindow.Instance.CloseWin(false);
                    this.Close();
                    break;
                case "cancel":
                    this.Close();
                    //                   DrugAndEventWindow.Instance.CloseWin(false);
                    break;
            }
        }

        private void CheckBox_Checked(object sender, RoutedEventArgs e)
        {
            CheckBox checkBox = sender as CheckBox;
            if (!(bool)checkBox.IsChecked)
            {
                _model.SelectAnesMethod = null;
            }
            else
            {
                _model.SelectAnesMethod = ((SelHisAnesMethodModel)(checkBox.DataContext));
            }
        }

        private void DataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {

        }
    }
}
